import request from '@/utils/zyrequest'
import qs from 'qs'
import { getToken } from '@/utils/auth'


export default {

  // 查询用户名是否重复
  queryUserName(username) {
    return request({
      url: '/user/user/queryUserName',
      method: 'get',
      params: {
        username: `${username}`
      },
      headers: {
        'token': getToken()
      }
    })
  },


  // 查询昵称是否重复
  queryNickName(nickname) {
    return request({
      url: '/user/user/queryNickName',
      method: 'get',
      params: {
        nickname: `${nickname}`
      },
      headers: {
        'token': getToken()
      }
    })
  },
  // 查询用户名是否重复
  queryUserName(username) {
    return request({
      url: '/user/user/queryUserName',
      method: 'get',
      params: {
        username: `${username}`
      },
      headers: {
        'token': getToken()
      }
    })
  },

  // 查询用户信息
  queryUser(username, password) {
    return request({
      url: '/user/user/queryUser',
      method: 'post',
      params: {
        username: `${username}`,
        password: `${password}`
      },
      headers: {
        'token': getToken()
      }
    })
  },

  update(pojo) {
    return request({
      url: '/user/user/update',
      method: 'put',
      data: JSON.stringify(pojo),
      headers: {
        'Content-type': 'application/json;charset=UTF-8',
        'token': getToken()
      }
    })
  }
} 